<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 28. Applying the prepared theme</title><link rel="stylesheet" type="text/css" href="manual.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.0"><link rel="home" href="index.html" title="JpGraph Manual"><link rel="up" href="pt07.html" title="Part VII. Theme Class"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 28. Applying the prepared theme</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center">Part VII. Theme Class</th><td width="20%" align="right"> </td></tr></table><hr></div><div class="chapter" title="Chapter 28. Applying the prepared theme"><div class="titlepage"><div><div><h2 class="title"><a name="id2619278"></a>Chapter 28. Applying the prepared theme</h2></div></div></div>
        
        <p>To understand how themes are used, it is easiest to look at the sample code. For example, the Aqua Theme can be applied using the following.
		</p>
		<p>
			</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
2
3
4
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-inlinetags">&lt;?php</span><span class="hl-code">
</span><span class="hl-var">$theme_class</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">AquaTheme</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-var">$graph</span><span class="hl-code">-&gt;</span><span class="hl-identifier">SetTheme</span><span class="hl-brackets">(</span><span class="hl-var">$theme_class</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-inlinetags">?&gt;</span></pre></td></tr></table></div><p>
		</p>
		<p> In line 1, an instance of AquaTheme class is created, and the graph theme is changed by passing the instance to SetTheme().  To use 'GreenTheme' instead of 'AquaTheme', use the following.
		</p>
		<p>
			</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-code">$theme_class = new GreenTheme;</span></pre></td></tr></table></div><p>
		</p>
		<p>All theme classes inherit the abstract 'Theme' class.
		</p>
        <p></p>
        
        <p>
            </p><div class="figure"><a name="fig.aqua_example"></a><p class="title"><b>Figure 28.1. Aqua Theme <code class="uri"><a class="uri" href="example_src/aqua_example.html" target="_top">(<code class="filename">aqua_example.php</code>)</a></code> </b></p><div class="figure-contents">  <span class="inlinemediaobject"><img src="images/aqua_example.png" alt="Aqua Theme (aqua_example.php)"></span> </div></div><p><br class="figure-break">
            </p><div class="figure"><a name="fig.green_example"></a><p class="title"><b>Figure 28.2. Green Theme <code class="uri"><a class="uri" href="example_src/green_example.html" target="_top">(<code class="filename">green_example.php</code>)</a></code> </b></p><div class="figure-contents">  <span class="inlinemediaobject"><img src="images/green_example.png" alt="Green Theme (green_example.php)"></span> </div></div><p><br class="figure-break">
            </p><div class="figure"><a name="fig.ocean_example"></a><p class="title"><b>Figure 28.3. Ocean Theme <code class="uri"><a class="uri" href="example_src/ocean_example.html" target="_top">(<code class="filename">ocean_example.php</code>)</a></code> </b></p><div class="figure-contents">  <span class="inlinemediaobject"><img src="images/ocean_example.png" alt="Ocean Theme (ocean_example.php)"></span> </div></div><p><br class="figure-break">
            </p><div class="figure"><a name="fig.pastel_example"></a><p class="title"><b>Figure 28.4. Pastel Theme <code class="uri"><a class="uri" href="example_src/pastel_example.html" target="_top">(<code class="filename">pastel_example.php</code>)</a></code> </b></p><div class="figure-contents">  <span class="inlinemediaobject"><img src="images/pastel_example.png" alt="Pastel Theme (pastel_example.php)"></span> </div></div><p><br class="figure-break">
            </p><div class="figure"><a name="fig.softy_example"></a><p class="title"><b>Figure 28.5. Softy Theme <code class="uri"><a class="uri" href="example_src/softy_example.html" target="_top">(<code class="filename">softy_example.php</code>)</a></code> </b></p><div class="figure-contents">  <span class="inlinemediaobject"><img src="images/softy_example.png" alt="Softy Theme (softy_example.php)"></span> </div></div><p><br class="figure-break">
            </p><div class="figure"><a name="fig.vivid_example"></a><p class="title"><b>Figure 28.6. Vivid Theme <code class="uri"><a class="uri" href="example_src/vivid_example.html" target="_top">(<code class="filename">vivid_example.php</code>)</a></code> </b></p><div class="figure-contents">  <span class="inlinemediaobject"><img src="images/vivid_example.png" alt="Vivid Theme (vivid_example.php)"></span> </div></div><p><br class="figure-break">
            </p><div class="figure"><a name="fig.orange_example"></a><p class="title"><b>Figure 28.7. Orange Theme <code class="uri"><a class="uri" href="example_src/orange_example.html" target="_top">(<code class="filename">orange_example.php</code>)</a></code> </b></p><div class="figure-contents">  <span class="inlinemediaobject"><img src="images/orange_example.png" alt="Orange Theme (orange_example.php)"></span> </div></div><p><br class="figure-break">
            </p><div class="figure"><a name="fig.rose_example"></a><p class="title"><b>Figure 28.8. Rose Theme <code class="uri"><a class="uri" href="example_src/rose_example.html" target="_top">(<code class="filename">rose_example.php</code>)</a></code> </b></p><div class="figure-contents">  <span class="inlinemediaobject"><img src="images/rose_example.png" alt="Rose Theme (rose_example.php)"></span> </div></div><p><br class="figure-break">
            </p><div class="figure"><a name="fig.universal_example"></a><p class="title"><b>Figure 28.9. Universal Theme <code class="uri"><a class="uri" href="example_src/universal_example.html" target="_top">(<code class="filename">universal_example.php</code>)</a></code> </b></p><div class="figure-contents">  <span class="inlinemediaobject"><img src="images/universal_example.png" alt="Universal Theme (universal_example.php)"></span> </div></div><p><br class="figure-break">
        </p>
    </div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"><a accesskey="u" href="pt07.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>
